#ifndef _UNBLIST_TEST_H_
#define _UNBLIST_TEST_H_

#include "util.h"

U_nbList l1;

const int unblist_data1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
const int unblist_data2[5] = {1, 3, 5, 7, 9};
const int unblist_data3[5] = {2, 4, 6, 8, 10};

SETUP(unblist)
{
    l1 = U_nbListNew();
};

DESTROY(unblist)
{
    U_nbListDestroy(l1);
};

TEST(unblist, Enter)
{
    int i;
        
    U_nbListClear(l1);
    
    for(i = 0; i < 10; ++i)
    {
        U_nbListEnter(l1, (void*)unblist_data1[i]);
    }
    for(i = 0; i < 10; ++i)
        ctf_assert_cmd(
            "amount of node entered should be the same as entered",
            U_nbListCount(l1) == 10,
            printf("U_nbListCount = %d\n", U_nbListCount(l1)));
    return 0;
};

TEST(unblist, AddEdge)
{
    int i;

    U_nbListClear(l1);
    
    for (i = 0; i < 5; ++i)
        U_nbListAddEdge(l1, (void*)unblist_data2[i], (void*)unblist_data3[i]);
    for (i = 0; i < 5; ++i)
    {
        ctf_assert(
            "edge added into a nblist should be Adjacent",
            U_nbListIsAdj(l1, (void*)unblist_data2[i], (void*)unblist_data3[i]));
        ctf_assert(
            "edge added into a nblist with revert sequence should not be Adjacent",
            ! U_nbListIsAdj(l1, (void*)unblist_data3[i], (void*)unblist_data2[i]));
    }
    ctf_assert_cmd(
        "node number should equal to edges added",
        U_nbListCount(l1) == 10,
        printf("U_nbListCount = %d\n", U_nbListCount(l1))) ;
    return 0;
};



#endif /* _UNBLIST_TEST_H_ */
